home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 10 / FM Towns Free Software Collection 10.iso / ms_dos / tool / chatfil / source / chatfil.c
C/C++ Source or Header  |  1994-12-21  |  1KB  |  52 lines

  1. #include<stdio.h>
  2.  
  3. main(int argc,char *argv[])
  4. {
  5.     FILE *fin,*fout;
  6.     char s[256];
  7.  
  8.     if(argc!=3){
  9.         printf("NetCock用チャットファイルフィルター v0.01\n");
  10.         printf("    Copyright(c)1994 MASAYA FUJIMOTO all rights reserved.\n");
  11.         printf("\n");
  12.         printf("        使い方:chatfil inputfile outputfile\n");
  13.         printf("\n");
  14.         exit(1);
  15.     }
  16.  
  17.     if((fin=fopen(argv[1],"r"))==NULL){
  18.         printf("入力ファイルが開けませんのら!\n");
  19.         exit(1);
  20.     }
  21.  
  22.     if((fout=fopen(argv[2],"w"))==NULL){
  23.         printf("出力ファイルが開けませんのら!\n");
  24.         exit(1);
  25.     }
  26.  
  27.  
  28.     printf("NetCock用チャットファイルフィルター v0.01\n");
  29.     printf("    Copyright(c)1994 MASAYA FUJIMOTO all rights reserved.\n");
  30.     printf("…ただいま処理中\n");
  31.  
  32.     while(fgets(s,256,fin)!=NULL){
  33.         if(s[0]=='('){
  34.             if(fputs(s,fout)==EOF){
  35.                 printf("出力エラー発生");
  36.                 fclose(fout);
  37.                 fclose(fin);
  38.                 exit(1);
  39.             }
  40.             if(fputs("\n",fout)==EOF){
  41.                 printf("出力エラー発生");
  42.                 fclose(fout);
  43.                 fclose(fin);
  44.                 exit(1);
  45.             }
  46.         }
  47.     }
  48.     fclose(fout);
  49.     fclose(fin);
  50.     printf("おしまい☆");
  51. }
  52.